import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.config.productionTip = false

Vue.use(ElementUI)

// 路由守卫，如：进入一个页面前需要检查下是否登录，是否有权限等操作
router.beforeEach((to,from,next)=>{
  console.log('to',to.path)
  console.log('from',from.path)
  next() // 一定要调用下next否则路由会卡住，不会往下进行了
})

new Vue({
  router,
  store,
  render: h => h(App),
  created () {
    store.commit('addMenu',router);
  },
}).$mount('#app')
